import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/widgets.dart';

class GestureDetectorDemo extends StatefulWidget {
  const GestureDetectorDemo({Key? key}) : super(key: key);

  @override
  State<GestureDetectorDemo> createState() => _GestureDetectorDemoState();
}

class _GestureDetectorDemoState extends State<GestureDetectorDemo> {
 Object groupValue = 1;
 bool selectA = false;
 bool selectB = true;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title:const Text("手势处理GestureDetector") ,
        centerTitle: true,
      ),
      body: Column(
        children: [
          FlatButton(
            onPressed: (){
              print("点击了");
            }, 
            child: Text("点击了")
          ),
          GestureDetector(
            // 单点事件
            onTap: (){
              print("onTap 点下按起");
            },
            // 
            onLongPress: (){
              print("长按事件");
            },
            onTapDown: (de){
              print("按下");
            },
            onTapUp: (de){
              print("抬起");

            },
            child: Container(
              color: Colors.grey,
              width: 280,
              height: 132,
              margin: EdgeInsets.all(10),
            ),
          ),
          /// 处理点击事件
          InkWell(
            onTap: (){
              print("处理点击事件");
            },
            child: Container(
              alignment: Alignment(0,0),
              width: 200,
              height: 200,
              color: Colors.grey,
              child: Text("InkWell"),
              
            ),
          ),
          SizedBox(height: 20,),
          Ink(
            // 用来设置形状
            
            child: InkWell(
              borderRadius: BorderRadius.all(Radius.circular(22)),
              splashColor: Colors.blue[700],
              highlightColor: Colors.blue[600],
              onTap: (){
                print("inkWell 点击事件");
              },
              child: Container(
              decoration: BoxDecoration(
                color: Colors.grey[400],
                borderRadius: BorderRadius.all(Radius.circular(22))
              ),
              alignment: Alignment(0,0),
              width: 100,
              height: 40,
              child: Text("InkWell"),
              
            ),


            ),
          )
          
        ],
      ),
    );
    
  }
}